package com.apes.auto.car.service;

import com.apes.auto.car.model.VehicleType;
import com.apes.auto.car.repository.VehicleTypeRepository;
import com.apes.framework.api.DomainService;
import com.apes.framework.plugin.esb.api.SimpleRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @ClassName VehicleTypeService
 * @Description TODO
 * @Author pengyb
 * @Date 2019/7/12 13:49
 * @Version 1.0
 **/
@Service("vehicleTypeService")
public class VehicleTypeService extends DomainService {
    @Autowired
    private VehicleTypeRepository vehicleTypeRepository;

    public VehicleType save(SimpleRequest request) {
        VehicleType o = request.getO(VehicleType.class);
        return vehicleTypeRepository.saveAndFlush(o);
    }

    public String delete(SimpleRequest request) {
        VehicleType o = request.getO(VehicleType.class);
        vehicleTypeRepository.delete(o.getId());
        return "删除成功";
    }

}
